<!--
 * @Description: 
 * @Author: xiongkuobiao
 * @Date: 2023-02-07 10:19:15
 * @LastEditors: xiongkuobiao
 * @LastEditTime: 2023-02-07 11:38:13
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    // 箭头函数  call.apply.bind  obj  普通函数   new实例化

    // Function.prototype.myCall = function (obj, ...args) {
    //   let key = Symbol();
    //   obj[key] = this;
    //   let result = obj[key](...args);
    //   delete obj[key];
    //   return result;
    // };
    // Function.prototype.myApply = function (obj, args) {
    //   let key = Symbol();
    //   obj[key] = this;
    //   let result = obj[key](...args);
    //   delete obj[key];
    //   return result;
    // };

    // Function.prototype.myBind = function (obj, ...args) {
    //   let that = this;
    //   return function (...args1) {
    //     let key = Symbol();
    //     obj[key] = that;
    //     let result = obj[key](...args, ...args1);
    //     delete obj[key];
    //     return result;
    //   };
    // };

    // // eg:
    // function demo(...args) {
    //   console.log(this.name, args);
    // }
    // var name = "window";
    // let obj = {
    //   name: "obj",
    // };
    // demo.myBind(obj, 123, 321)(123, 123, 123);
  </script>
</html>
